home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / ins_msb / 9203 / curdir.bas < prev    next >
BASIC Source File  |  1992-01-28  |  816b  |  34 lines

  1. ' CurDir.Bas - Support module to contain the CurDir$ function.
  2.  
  3. ' $INCLUDE: 'CURDIR.BI'
  4. ' $INCLUDE: 'QB.BI'
  5.  
  6.  
  7. FUNCTION CurDir$
  8. ' CurDir$ -     Returns a string containing the current working
  9. '               drive and directory.
  10.  
  11. DIM Regs AS RegTypeX
  12. DIM cwdTmp1 AS STRING * 64
  13. DIM cwDrv AS INTEGER
  14.  
  15. Regs.AX = &H1900             ' get current disk
  16. InterruptX &H21, Regs, Regs
  17.  
  18. cwDrv = Regs.AX AND &HFF
  19.  
  20. LSET cwdTmp1 = ""
  21.  
  22. Regs.AX = &H4700             ' get current working direcory
  23. Regs.DX = 0                  ' specify current drive
  24. Regs.DS = VARSEG(cwdTmp1)
  25. Regs.SI = VARPTR(cwdTmp1)
  26. InterruptX &H21, Regs, Regs
  27.  
  28. ' Construct the final current directory string.
  29. cwdTmp2$ = CHR$(cwDrv + &H41) + ":\" 
  30. CurDir$ = cwdTmp2$ + MID$(cwdTmp1, 1, INSTR(cwdTmp1, CHR$(0)) - 1)
  31.  
  32. END FUNCTION
  33.  
  34.